<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <title>信发系统（终端）</title>
    <link rel="shortcut icon" href="./img/favicon.ico" type="image/x-icon"/>
    <link href="./css/admin/base-v2.css" rel="stylesheet">
    <link href="./css/admin/player.css" rel="stylesheet">
    <script src="https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js"></script>
    <script>
        var vConsole = new VConsole();
    </script>
</head>
<body>
<script src="./lib/jquery.min.js"></script>
<script src="./js/popup.js"></script>
<script src="./lib/vue/v2.5.16/vue.min.js"></script>
<div class="app-container" id="app-container">
    <div class="scene-box" :style="{width:list.canvasWidth/fontSize+'rem',height:list.canvasHeight/fontSize+'rem'}">
        <div class="scene" v-if="list.scene" :style="list.scene.style">
            <div class="group-box">
                <div class="group" v-for="group in list.scene.groups"
                     :style="{left:(group.left/fontSize)+'rem',top:(group.top/fontSize)+'rem',
             width:(group.width/fontSize)+'rem',height:(group.height/fontSize)+'rem' }">
                    <div class="module-box">
                        <div class="module" v-if="group.module">
                            <div class="module-media">
                                <!--<img :src="group.module.thumbnailUrl" v-if="group.module.type==1">-->
                                <img :src="group.module.url" v-if="group.module.type==0">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="./js/vue.js"></script>
<script>
    //动态修改1rem的大小
    function fontSize() {
        var width = screen.width;
        $("html").css("fontSize", width / 320 * 20 + "px");
        console.log($("html").css("fontSize"))
    }

    fontSize();
    var defaultOption = '###program###';

    //数据检查
    function dataCheck(option) {
        //对数据进行检查，是否scenes为空，groups为空，modules为空，若存在为空的情况则停止程序执行，并给出提示
        if (option.scenes == undefined || option.scenes == "") {
            console.log("场景数组不能为空")
            return;
        } else {
            for (var i of option.scenes) {
                if (i.groups == undefined || i.groups == "") {
                    console.log("分组不能为空");
                    return;
                } else {
                    for (var j of i.groups) {
                        if (j.modules == undefined || j.modules == "") {
                            console.log("模块不能为空")
                            return;
                        } else {
                            return true;
                        }
                    }
                }

            }
        }
    }

    if (dataCheck(defaultOption)) {
        console.log("数据结构正确");
        // 当前场景
        if (window.ck) {
            defaultOption.scene = {};
            //当前场景的序号
            defaultOption.order = 0;
            //当前场景轮询次数
            defaultOption.times = 1;
            V.list = defaultOption;
            sdk.play();
        } else {
            console.log("不存在ck");
            popup.tipsTop("不存在ck");
        }
    }


</script>
</body>
</html>